// $ANTLR 3.1.3 Mar 17, 2009 19:23:44 ValParser.g 2010-01-30 20:46:32

  package org.concepts.java.antlr.validator;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;


import org.antlr.runtime.tree.*;

public class ValParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "SPECIALCHARACTERS", "ALPHANUMERIC", "EQUAL", "QUOTE", "DOLLAR", "LPAREN", "RPAREN", "COMMA", "STRING", "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "GT", "LT", "GTE", "LTE", "EQ", "NEQ", "AND", "OR", "NOT", "WHITESPACE", "NEWLINE", "SINGLE_COMMENT", "MULTI_COMMENT", "EXPR", "VARIABLES", "VARIABLE", "NAME", "VALUE", "FUNCTION", "PARAM"
    };
    public static final int FUNCTION=35;
    public static final int DOLLAR=8;
    public static final int LT=18;
    public static final int GTE=19;
    public static final int MULTI_COMMENT=29;
    public static final int WHITESPACE=26;
    public static final int PARAM=36;
    public static final int NOT=25;
    public static final int VALUE=34;
    public static final int MINUS=14;
    public static final int AND=23;
    public static final int EOF=-1;
    public static final int LTE=20;
    public static final int LPAREN=9;
    public static final int QUOTE=7;
    public static final int RPAREN=10;
    public static final int NAME=33;
    public static final int EXPR=30;
    public static final int NEQ=22;
    public static final int VARIABLE=32;
    public static final int NEWLINE=27;
    public static final int MULTIPLY=15;
    public static final int COMMA=11;
    public static final int ALPHANUMERIC=5;
    public static final int EQUAL=6;
    public static final int OR=24;
    public static final int VARIABLES=31;
    public static final int GT=17;
    public static final int PLUS=13;
    public static final int SINGLE_COMMENT=28;
    public static final int EQ=21;
    public static final int SPECIALCHARACTERS=4;
    public static final int DIVIDE=16;
    public static final int STRING=12;

    // delegates
    // delegators


        public ValParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public ValParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        
    protected TreeAdaptor adaptor = new CommonTreeAdaptor();

    public void setTreeAdaptor(TreeAdaptor adaptor) {
        this.adaptor = adaptor;
    }
    public TreeAdaptor getTreeAdaptor() {
        return adaptor;
    }

    public String[] getTokenNames() { return ValParser.tokenNames; }
    public String getGrammarFileName() { return "ValParser.g"; }


    public static class validator_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "validator"
    // ValParser.g:48:1: validator : ( variableDeclaration )* ( expr )? -> ^( VARIABLES ( variableDeclaration )* ) ^( EXPR expr ) ;
    public final ValParser.validator_return validator() throws RecognitionException {
        ValParser.validator_return retval = new ValParser.validator_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        ValParser.variableDeclaration_return variableDeclaration1 = null;

        ValParser.expr_return expr2 = null;


        RewriteRuleSubtreeStream stream_variableDeclaration=new RewriteRuleSubtreeStream(adaptor,"rule variableDeclaration");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ValParser.g:48:10: ( ( variableDeclaration )* ( expr )? -> ^( VARIABLES ( variableDeclaration )* ) ^( EXPR expr ) )
            // ValParser.g:48:12: ( variableDeclaration )* ( expr )?
            {
            // ValParser.g:48:12: ( variableDeclaration )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==ALPHANUMERIC) ) {
                    int LA1_1 = input.LA(2);

                    if ( ((LA1_1>=SPECIALCHARACTERS && LA1_1<=EQUAL)) ) {
                        alt1=1;
                    }


                }


                switch (alt1) {
            	case 1 :
            	    // ValParser.g:48:12: variableDeclaration
            	    {
            	    pushFollow(FOLLOW_variableDeclaration_in_validator85);
            	    variableDeclaration1=variableDeclaration();

            	    state._fsp--;

            	    stream_variableDeclaration.add(variableDeclaration1.getTree());

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);

            // ValParser.g:48:33: ( expr )?
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( ((LA2_0>=SPECIALCHARACTERS && LA2_0<=ALPHANUMERIC)||(LA2_0>=DOLLAR && LA2_0<=LPAREN)||LA2_0==STRING) ) {
                alt2=1;
            }
            switch (alt2) {
                case 1 :
                    // ValParser.g:48:33: expr
                    {
                    pushFollow(FOLLOW_expr_in_validator88);
                    expr2=expr();

                    state._fsp--;

                    stream_expr.add(expr2.getTree());

                    }
                    break;

            }



            // AST REWRITE
            // elements: variableDeclaration, expr
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 49:2: -> ^( VARIABLES ( variableDeclaration )* ) ^( EXPR expr )
            {
                // ValParser.g:49:5: ^( VARIABLES ( variableDeclaration )* )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VARIABLES, "VARIABLES"), root_1);

                // ValParser.g:49:17: ( variableDeclaration )*
                while ( stream_variableDeclaration.hasNext() ) {
                    adaptor.addChild(root_1, stream_variableDeclaration.nextTree());

                }
                stream_variableDeclaration.reset();

                adaptor.addChild(root_0, root_1);
                }
                // ValParser.g:49:39: ^( EXPR expr )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(EXPR, "EXPR"), root_1);

                adaptor.addChild(root_1, stream_expr.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "validator"

    public static class variableName_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "variableName"
    // ValParser.g:56:1: variableName : ALPHANUMERIC ( ALPHANUMERIC | SPECIALCHARACTERS )* ;
    public final ValParser.variableName_return variableName() throws RecognitionException {
        ValParser.variableName_return retval = new ValParser.variableName_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token ALPHANUMERIC3=null;
        Token set4=null;

        Object ALPHANUMERIC3_tree=null;
        Object set4_tree=null;

        try {
            // ValParser.g:56:15: ( ALPHANUMERIC ( ALPHANUMERIC | SPECIALCHARACTERS )* )
            // ValParser.g:56:17: ALPHANUMERIC ( ALPHANUMERIC | SPECIALCHARACTERS )*
            {
            root_0 = (Object)adaptor.nil();

            ALPHANUMERIC3=(Token)match(input,ALPHANUMERIC,FOLLOW_ALPHANUMERIC_in_variableName118); 
            ALPHANUMERIC3_tree = (Object)adaptor.create(ALPHANUMERIC3);
            adaptor.addChild(root_0, ALPHANUMERIC3_tree);

            // ValParser.g:56:30: ( ALPHANUMERIC | SPECIALCHARACTERS )*
            loop3:
            do {
                int alt3=2;
                int LA3_0 = input.LA(1);

                if ( ((LA3_0>=SPECIALCHARACTERS && LA3_0<=ALPHANUMERIC)) ) {
                    alt3=1;
                }


                switch (alt3) {
            	case 1 :
            	    // ValParser.g:
            	    {
            	    set4=(Token)input.LT(1);
            	    if ( (input.LA(1)>=SPECIALCHARACTERS && input.LA(1)<=ALPHANUMERIC) ) {
            	        input.consume();
            	        adaptor.addChild(root_0, (Object)adaptor.create(set4));
            	        state.errorRecovery=false;
            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        throw mse;
            	    }


            	    }
            	    break;

            	default :
            	    break loop3;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "variableName"

    public static class variableDeclaration_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "variableDeclaration"
    // ValParser.g:58:1: variableDeclaration : variableName EQUAL expr QUOTE -> ^( VARIABLE ^( NAME variableName ) ^( VALUE expr ) ) ;
    public final ValParser.variableDeclaration_return variableDeclaration() throws RecognitionException {
        ValParser.variableDeclaration_return retval = new ValParser.variableDeclaration_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token EQUAL6=null;
        Token QUOTE8=null;
        ValParser.variableName_return variableName5 = null;

        ValParser.expr_return expr7 = null;


        Object EQUAL6_tree=null;
        Object QUOTE8_tree=null;
        RewriteRuleTokenStream stream_QUOTE=new RewriteRuleTokenStream(adaptor,"token QUOTE");
        RewriteRuleTokenStream stream_EQUAL=new RewriteRuleTokenStream(adaptor,"token EQUAL");
        RewriteRuleSubtreeStream stream_variableName=new RewriteRuleSubtreeStream(adaptor,"rule variableName");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ValParser.g:59:3: ( variableName EQUAL expr QUOTE -> ^( VARIABLE ^( NAME variableName ) ^( VALUE expr ) ) )
            // ValParser.g:59:6: variableName EQUAL expr QUOTE
            {
            pushFollow(FOLLOW_variableName_in_variableDeclaration139);
            variableName5=variableName();

            state._fsp--;

            stream_variableName.add(variableName5.getTree());
            EQUAL6=(Token)match(input,EQUAL,FOLLOW_EQUAL_in_variableDeclaration142);  
            stream_EQUAL.add(EQUAL6);

            pushFollow(FOLLOW_expr_in_variableDeclaration145);
            expr7=expr();

            state._fsp--;

            stream_expr.add(expr7.getTree());
            QUOTE8=(Token)match(input,QUOTE,FOLLOW_QUOTE_in_variableDeclaration148);  
            stream_QUOTE.add(QUOTE8);



            // AST REWRITE
            // elements: expr, variableName
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 60:3: -> ^( VARIABLE ^( NAME variableName ) ^( VALUE expr ) )
            {
                // ValParser.g:60:6: ^( VARIABLE ^( NAME variableName ) ^( VALUE expr ) )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(VARIABLE, "VARIABLE"), root_1);

                // ValParser.g:60:17: ^( NAME variableName )
                {
                Object root_2 = (Object)adaptor.nil();
                root_2 = (Object)adaptor.becomeRoot((Object)adaptor.create(NAME, "NAME"), root_2);

                adaptor.addChild(root_2, stream_variableName.nextTree());

                adaptor.addChild(root_1, root_2);
                }
                // ValParser.g:60:39: ^( VALUE expr )
                {
                Object root_2 = (Object)adaptor.nil();
                root_2 = (Object)adaptor.becomeRoot((Object)adaptor.create(VALUE, "VALUE"), root_2);

                adaptor.addChild(root_2, stream_expr.nextTree());

                adaptor.addChild(root_1, root_2);
                }

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "variableDeclaration"

    public static class variableReference_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "variableReference"
    // ValParser.g:66:1: variableReference : DOLLAR variableName -> ^( DOLLAR variableName ) ;
    public final ValParser.variableReference_return variableReference() throws RecognitionException {
        ValParser.variableReference_return retval = new ValParser.variableReference_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token DOLLAR9=null;
        ValParser.variableName_return variableName10 = null;


        Object DOLLAR9_tree=null;
        RewriteRuleTokenStream stream_DOLLAR=new RewriteRuleTokenStream(adaptor,"token DOLLAR");
        RewriteRuleSubtreeStream stream_variableName=new RewriteRuleSubtreeStream(adaptor,"rule variableName");
        try {
            // ValParser.g:67:3: ( DOLLAR variableName -> ^( DOLLAR variableName ) )
            // ValParser.g:67:5: DOLLAR variableName
            {
            DOLLAR9=(Token)match(input,DOLLAR,FOLLOW_DOLLAR_in_variableReference186);  
            stream_DOLLAR.add(DOLLAR9);

            pushFollow(FOLLOW_variableName_in_variableReference188);
            variableName10=variableName();

            state._fsp--;

            stream_variableName.add(variableName10.getTree());


            // AST REWRITE
            // elements: DOLLAR, variableName
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 68:3: -> ^( DOLLAR variableName )
            {
                // ValParser.g:68:6: ^( DOLLAR variableName )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot(stream_DOLLAR.nextNode(), root_1);

                adaptor.addChild(root_1, stream_variableName.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "variableReference"

    public static class function_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "function"
    // ValParser.g:75:1: function : ALPHANUMERIC LPAREN ( expr )? ( COMMA expr )* RPAREN -> ^( FUNCTION ^( NAME ALPHANUMERIC ) ^( PARAM ( expr )* ) ) ;
    public final ValParser.function_return function() throws RecognitionException {
        ValParser.function_return retval = new ValParser.function_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token ALPHANUMERIC11=null;
        Token LPAREN12=null;
        Token COMMA14=null;
        Token RPAREN16=null;
        ValParser.expr_return expr13 = null;

        ValParser.expr_return expr15 = null;


        Object ALPHANUMERIC11_tree=null;
        Object LPAREN12_tree=null;
        Object COMMA14_tree=null;
        Object RPAREN16_tree=null;
        RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN");
        RewriteRuleTokenStream stream_COMMA=new RewriteRuleTokenStream(adaptor,"token COMMA");
        RewriteRuleTokenStream stream_ALPHANUMERIC=new RewriteRuleTokenStream(adaptor,"token ALPHANUMERIC");
        RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ValParser.g:76:3: ( ALPHANUMERIC LPAREN ( expr )? ( COMMA expr )* RPAREN -> ^( FUNCTION ^( NAME ALPHANUMERIC ) ^( PARAM ( expr )* ) ) )
            // ValParser.g:76:5: ALPHANUMERIC LPAREN ( expr )? ( COMMA expr )* RPAREN
            {
            ALPHANUMERIC11=(Token)match(input,ALPHANUMERIC,FOLLOW_ALPHANUMERIC_in_function214);  
            stream_ALPHANUMERIC.add(ALPHANUMERIC11);

            LPAREN12=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_function216);  
            stream_LPAREN.add(LPAREN12);

            // ValParser.g:76:25: ( expr )?
            int alt4=2;
            int LA4_0 = input.LA(1);

            if ( ((LA4_0>=SPECIALCHARACTERS && LA4_0<=ALPHANUMERIC)||(LA4_0>=DOLLAR && LA4_0<=LPAREN)||LA4_0==STRING) ) {
                alt4=1;
            }
            switch (alt4) {
                case 1 :
                    // ValParser.g:76:25: expr
                    {
                    pushFollow(FOLLOW_expr_in_function218);
                    expr13=expr();

                    state._fsp--;

                    stream_expr.add(expr13.getTree());

                    }
                    break;

            }

            // ValParser.g:76:31: ( COMMA expr )*
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( (LA5_0==COMMA) ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // ValParser.g:76:32: COMMA expr
            	    {
            	    COMMA14=(Token)match(input,COMMA,FOLLOW_COMMA_in_function222);  
            	    stream_COMMA.add(COMMA14);

            	    pushFollow(FOLLOW_expr_in_function224);
            	    expr15=expr();

            	    state._fsp--;

            	    stream_expr.add(expr15.getTree());

            	    }
            	    break;

            	default :
            	    break loop5;
                }
            } while (true);

            RPAREN16=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_function228);  
            stream_RPAREN.add(RPAREN16);



            // AST REWRITE
            // elements: ALPHANUMERIC, expr
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (Object)adaptor.nil();
            // 77:3: -> ^( FUNCTION ^( NAME ALPHANUMERIC ) ^( PARAM ( expr )* ) )
            {
                // ValParser.g:77:6: ^( FUNCTION ^( NAME ALPHANUMERIC ) ^( PARAM ( expr )* ) )
                {
                Object root_1 = (Object)adaptor.nil();
                root_1 = (Object)adaptor.becomeRoot((Object)adaptor.create(FUNCTION, "FUNCTION"), root_1);

                // ValParser.g:77:17: ^( NAME ALPHANUMERIC )
                {
                Object root_2 = (Object)adaptor.nil();
                root_2 = (Object)adaptor.becomeRoot((Object)adaptor.create(NAME, "NAME"), root_2);

                adaptor.addChild(root_2, stream_ALPHANUMERIC.nextNode());

                adaptor.addChild(root_1, root_2);
                }
                // ValParser.g:77:38: ^( PARAM ( expr )* )
                {
                Object root_2 = (Object)adaptor.nil();
                root_2 = (Object)adaptor.becomeRoot((Object)adaptor.create(PARAM, "PARAM"), root_2);

                // ValParser.g:77:46: ( expr )*
                while ( stream_expr.hasNext() ) {
                    adaptor.addChild(root_2, stream_expr.nextTree());

                }
                stream_expr.reset();

                adaptor.addChild(root_1, root_2);
                }

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "function"

    public static class expr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "expr"
    // ValParser.g:93:1: expr : andexpr ( OR andexpr )* ;
    public final ValParser.expr_return expr() throws RecognitionException {
        ValParser.expr_return retval = new ValParser.expr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token OR18=null;
        ValParser.andexpr_return andexpr17 = null;

        ValParser.andexpr_return andexpr19 = null;


        Object OR18_tree=null;

        try {
            // ValParser.g:93:7: ( andexpr ( OR andexpr )* )
            // ValParser.g:93:9: andexpr ( OR andexpr )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_andexpr_in_expr275);
            andexpr17=andexpr();

            state._fsp--;

            adaptor.addChild(root_0, andexpr17.getTree());
            // ValParser.g:93:18: ( OR andexpr )*
            loop6:
            do {
                int alt6=2;
                int LA6_0 = input.LA(1);

                if ( (LA6_0==OR) ) {
                    alt6=1;
                }


                switch (alt6) {
            	case 1 :
            	    // ValParser.g:93:19: OR andexpr
            	    {
            	    OR18=(Token)match(input,OR,FOLLOW_OR_in_expr279); 
            	    OR18_tree = (Object)adaptor.create(OR18);
            	    root_0 = (Object)adaptor.becomeRoot(OR18_tree, root_0);

            	    pushFollow(FOLLOW_andexpr_in_expr282);
            	    andexpr19=andexpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, andexpr19.getTree());

            	    }
            	    break;

            	default :
            	    break loop6;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "expr"

    public static class andexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "andexpr"
    // ValParser.g:95:1: andexpr : equalityexpr ( AND equalityexpr )* ;
    public final ValParser.andexpr_return andexpr() throws RecognitionException {
        ValParser.andexpr_return retval = new ValParser.andexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token AND21=null;
        ValParser.equalityexpr_return equalityexpr20 = null;

        ValParser.equalityexpr_return equalityexpr22 = null;


        Object AND21_tree=null;

        try {
            // ValParser.g:95:15: ( equalityexpr ( AND equalityexpr )* )
            // ValParser.g:95:17: equalityexpr ( AND equalityexpr )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_equalityexpr_in_andexpr299);
            equalityexpr20=equalityexpr();

            state._fsp--;

            adaptor.addChild(root_0, equalityexpr20.getTree());
            // ValParser.g:95:30: ( AND equalityexpr )*
            loop7:
            do {
                int alt7=2;
                int LA7_0 = input.LA(1);

                if ( (LA7_0==AND) ) {
                    alt7=1;
                }


                switch (alt7) {
            	case 1 :
            	    // ValParser.g:95:31: AND equalityexpr
            	    {
            	    AND21=(Token)match(input,AND,FOLLOW_AND_in_andexpr302); 
            	    AND21_tree = (Object)adaptor.create(AND21);
            	    root_0 = (Object)adaptor.becomeRoot(AND21_tree, root_0);

            	    pushFollow(FOLLOW_equalityexpr_in_andexpr305);
            	    equalityexpr22=equalityexpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, equalityexpr22.getTree());

            	    }
            	    break;

            	default :
            	    break loop7;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "andexpr"

    public static class equalityexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "equalityexpr"
    // ValParser.g:97:1: equalityexpr : relationalexpr ( ( EQ | NEQ ) relationalexpr )* ;
    public final ValParser.equalityexpr_return equalityexpr() throws RecognitionException {
        ValParser.equalityexpr_return retval = new ValParser.equalityexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token EQ24=null;
        Token NEQ25=null;
        ValParser.relationalexpr_return relationalexpr23 = null;

        ValParser.relationalexpr_return relationalexpr26 = null;


        Object EQ24_tree=null;
        Object NEQ25_tree=null;

        try {
            // ValParser.g:97:15: ( relationalexpr ( ( EQ | NEQ ) relationalexpr )* )
            // ValParser.g:97:17: relationalexpr ( ( EQ | NEQ ) relationalexpr )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_relationalexpr_in_equalityexpr316);
            relationalexpr23=relationalexpr();

            state._fsp--;

            adaptor.addChild(root_0, relationalexpr23.getTree());
            // ValParser.g:97:32: ( ( EQ | NEQ ) relationalexpr )*
            loop9:
            do {
                int alt9=2;
                int LA9_0 = input.LA(1);

                if ( ((LA9_0>=EQ && LA9_0<=NEQ)) ) {
                    alt9=1;
                }


                switch (alt9) {
            	case 1 :
            	    // ValParser.g:97:34: ( EQ | NEQ ) relationalexpr
            	    {
            	    // ValParser.g:97:34: ( EQ | NEQ )
            	    int alt8=2;
            	    int LA8_0 = input.LA(1);

            	    if ( (LA8_0==EQ) ) {
            	        alt8=1;
            	    }
            	    else if ( (LA8_0==NEQ) ) {
            	        alt8=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 8, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt8) {
            	        case 1 :
            	            // ValParser.g:97:35: EQ
            	            {
            	            EQ24=(Token)match(input,EQ,FOLLOW_EQ_in_equalityexpr321); 
            	            EQ24_tree = (Object)adaptor.create(EQ24);
            	            root_0 = (Object)adaptor.becomeRoot(EQ24_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // ValParser.g:97:41: NEQ
            	            {
            	            NEQ25=(Token)match(input,NEQ,FOLLOW_NEQ_in_equalityexpr326); 
            	            NEQ25_tree = (Object)adaptor.create(NEQ25);
            	            root_0 = (Object)adaptor.becomeRoot(NEQ25_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_relationalexpr_in_equalityexpr330);
            	    relationalexpr26=relationalexpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, relationalexpr26.getTree());

            	    }
            	    break;

            	default :
            	    break loop9;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "equalityexpr"

    public static class relationalexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "relationalexpr"
    // ValParser.g:99:1: relationalexpr : plusminusexpr ( ( GT | LT | GTE | LTE ) plusminusexpr )* ;
    public final ValParser.relationalexpr_return relationalexpr() throws RecognitionException {
        ValParser.relationalexpr_return retval = new ValParser.relationalexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token GT28=null;
        Token LT29=null;
        Token GTE30=null;
        Token LTE31=null;
        ValParser.plusminusexpr_return plusminusexpr27 = null;

        ValParser.plusminusexpr_return plusminusexpr32 = null;


        Object GT28_tree=null;
        Object LT29_tree=null;
        Object GTE30_tree=null;
        Object LTE31_tree=null;

        try {
            // ValParser.g:99:15: ( plusminusexpr ( ( GT | LT | GTE | LTE ) plusminusexpr )* )
            // ValParser.g:99:17: plusminusexpr ( ( GT | LT | GTE | LTE ) plusminusexpr )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_plusminusexpr_in_relationalexpr339);
            plusminusexpr27=plusminusexpr();

            state._fsp--;

            adaptor.addChild(root_0, plusminusexpr27.getTree());
            // ValParser.g:99:31: ( ( GT | LT | GTE | LTE ) plusminusexpr )*
            loop11:
            do {
                int alt11=2;
                int LA11_0 = input.LA(1);

                if ( ((LA11_0>=GT && LA11_0<=LTE)) ) {
                    alt11=1;
                }


                switch (alt11) {
            	case 1 :
            	    // ValParser.g:99:33: ( GT | LT | GTE | LTE ) plusminusexpr
            	    {
            	    // ValParser.g:99:33: ( GT | LT | GTE | LTE )
            	    int alt10=4;
            	    switch ( input.LA(1) ) {
            	    case GT:
            	        {
            	        alt10=1;
            	        }
            	        break;
            	    case LT:
            	        {
            	        alt10=2;
            	        }
            	        break;
            	    case GTE:
            	        {
            	        alt10=3;
            	        }
            	        break;
            	    case LTE:
            	        {
            	        alt10=4;
            	        }
            	        break;
            	    default:
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 10, 0, input);

            	        throw nvae;
            	    }

            	    switch (alt10) {
            	        case 1 :
            	            // ValParser.g:99:35: GT
            	            {
            	            GT28=(Token)match(input,GT,FOLLOW_GT_in_relationalexpr345); 
            	            GT28_tree = (Object)adaptor.create(GT28);
            	            root_0 = (Object)adaptor.becomeRoot(GT28_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // ValParser.g:99:41: LT
            	            {
            	            LT29=(Token)match(input,LT,FOLLOW_LT_in_relationalexpr350); 
            	            LT29_tree = (Object)adaptor.create(LT29);
            	            root_0 = (Object)adaptor.becomeRoot(LT29_tree, root_0);


            	            }
            	            break;
            	        case 3 :
            	            // ValParser.g:99:47: GTE
            	            {
            	            GTE30=(Token)match(input,GTE,FOLLOW_GTE_in_relationalexpr355); 
            	            GTE30_tree = (Object)adaptor.create(GTE30);
            	            root_0 = (Object)adaptor.becomeRoot(GTE30_tree, root_0);


            	            }
            	            break;
            	        case 4 :
            	            // ValParser.g:99:54: LTE
            	            {
            	            LTE31=(Token)match(input,LTE,FOLLOW_LTE_in_relationalexpr360); 
            	            LTE31_tree = (Object)adaptor.create(LTE31);
            	            root_0 = (Object)adaptor.becomeRoot(LTE31_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_plusminusexpr_in_relationalexpr365);
            	    plusminusexpr32=plusminusexpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, plusminusexpr32.getTree());

            	    }
            	    break;

            	default :
            	    break loop11;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "relationalexpr"

    public static class plusminusexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "plusminusexpr"
    // ValParser.g:101:1: plusminusexpr : multdivideexpr ( ( PLUS | MINUS ) multdivideexpr )* ;
    public final ValParser.plusminusexpr_return plusminusexpr() throws RecognitionException {
        ValParser.plusminusexpr_return retval = new ValParser.plusminusexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token PLUS34=null;
        Token MINUS35=null;
        ValParser.multdivideexpr_return multdivideexpr33 = null;

        ValParser.multdivideexpr_return multdivideexpr36 = null;


        Object PLUS34_tree=null;
        Object MINUS35_tree=null;

        try {
            // ValParser.g:101:15: ( multdivideexpr ( ( PLUS | MINUS ) multdivideexpr )* )
            // ValParser.g:101:17: multdivideexpr ( ( PLUS | MINUS ) multdivideexpr )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_multdivideexpr_in_plusminusexpr379);
            multdivideexpr33=multdivideexpr();

            state._fsp--;

            adaptor.addChild(root_0, multdivideexpr33.getTree());
            // ValParser.g:101:32: ( ( PLUS | MINUS ) multdivideexpr )*
            loop13:
            do {
                int alt13=2;
                int LA13_0 = input.LA(1);

                if ( ((LA13_0>=PLUS && LA13_0<=MINUS)) ) {
                    alt13=1;
                }


                switch (alt13) {
            	case 1 :
            	    // ValParser.g:101:34: ( PLUS | MINUS ) multdivideexpr
            	    {
            	    // ValParser.g:101:34: ( PLUS | MINUS )
            	    int alt12=2;
            	    int LA12_0 = input.LA(1);

            	    if ( (LA12_0==PLUS) ) {
            	        alt12=1;
            	    }
            	    else if ( (LA12_0==MINUS) ) {
            	        alt12=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 12, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt12) {
            	        case 1 :
            	            // ValParser.g:101:35: PLUS
            	            {
            	            PLUS34=(Token)match(input,PLUS,FOLLOW_PLUS_in_plusminusexpr384); 
            	            PLUS34_tree = (Object)adaptor.create(PLUS34);
            	            root_0 = (Object)adaptor.becomeRoot(PLUS34_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // ValParser.g:101:43: MINUS
            	            {
            	            MINUS35=(Token)match(input,MINUS,FOLLOW_MINUS_in_plusminusexpr389); 
            	            MINUS35_tree = (Object)adaptor.create(MINUS35);
            	            root_0 = (Object)adaptor.becomeRoot(MINUS35_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_multdivideexpr_in_plusminusexpr393);
            	    multdivideexpr36=multdivideexpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, multdivideexpr36.getTree());

            	    }
            	    break;

            	default :
            	    break loop13;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "plusminusexpr"

    public static class multdivideexpr_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "multdivideexpr"
    // ValParser.g:103:1: multdivideexpr : atom ( ( MULTIPLY | DIVIDE ) atom )* ;
    public final ValParser.multdivideexpr_return multdivideexpr() throws RecognitionException {
        ValParser.multdivideexpr_return retval = new ValParser.multdivideexpr_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token MULTIPLY38=null;
        Token DIVIDE39=null;
        ValParser.atom_return atom37 = null;

        ValParser.atom_return atom40 = null;


        Object MULTIPLY38_tree=null;
        Object DIVIDE39_tree=null;

        try {
            // ValParser.g:103:15: ( atom ( ( MULTIPLY | DIVIDE ) atom )* )
            // ValParser.g:103:17: atom ( ( MULTIPLY | DIVIDE ) atom )*
            {
            root_0 = (Object)adaptor.nil();

            pushFollow(FOLLOW_atom_in_multdivideexpr402);
            atom37=atom();

            state._fsp--;

            adaptor.addChild(root_0, atom37.getTree());
            // ValParser.g:103:22: ( ( MULTIPLY | DIVIDE ) atom )*
            loop15:
            do {
                int alt15=2;
                int LA15_0 = input.LA(1);

                if ( ((LA15_0>=MULTIPLY && LA15_0<=DIVIDE)) ) {
                    alt15=1;
                }


                switch (alt15) {
            	case 1 :
            	    // ValParser.g:103:24: ( MULTIPLY | DIVIDE ) atom
            	    {
            	    // ValParser.g:103:24: ( MULTIPLY | DIVIDE )
            	    int alt14=2;
            	    int LA14_0 = input.LA(1);

            	    if ( (LA14_0==MULTIPLY) ) {
            	        alt14=1;
            	    }
            	    else if ( (LA14_0==DIVIDE) ) {
            	        alt14=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 14, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt14) {
            	        case 1 :
            	            // ValParser.g:103:25: MULTIPLY
            	            {
            	            MULTIPLY38=(Token)match(input,MULTIPLY,FOLLOW_MULTIPLY_in_multdivideexpr407); 
            	            MULTIPLY38_tree = (Object)adaptor.create(MULTIPLY38);
            	            root_0 = (Object)adaptor.becomeRoot(MULTIPLY38_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // ValParser.g:103:37: DIVIDE
            	            {
            	            DIVIDE39=(Token)match(input,DIVIDE,FOLLOW_DIVIDE_in_multdivideexpr412); 
            	            DIVIDE39_tree = (Object)adaptor.create(DIVIDE39);
            	            root_0 = (Object)adaptor.becomeRoot(DIVIDE39_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_atom_in_multdivideexpr416);
            	    atom40=atom();

            	    state._fsp--;

            	    adaptor.addChild(root_0, atom40.getTree());

            	    }
            	    break;

            	default :
            	    break loop15;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "multdivideexpr"

    public static class atom_return extends ParserRuleReturnScope {
        Object tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "atom"
    // ValParser.g:105:1: atom : ( function | variableReference | STRING | ALPHANUMERIC | SPECIALCHARACTERS | LPAREN expr RPAREN -> expr );
    public final ValParser.atom_return atom() throws RecognitionException {
        ValParser.atom_return retval = new ValParser.atom_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token STRING43=null;
        Token ALPHANUMERIC44=null;
        Token SPECIALCHARACTERS45=null;
        Token LPAREN46=null;
        Token RPAREN48=null;
        ValParser.function_return function41 = null;

        ValParser.variableReference_return variableReference42 = null;

        ValParser.expr_return expr47 = null;


        Object STRING43_tree=null;
        Object ALPHANUMERIC44_tree=null;
        Object SPECIALCHARACTERS45_tree=null;
        Object LPAREN46_tree=null;
        Object RPAREN48_tree=null;
        RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN");
        RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // ValParser.g:106:2: ( function | variableReference | STRING | ALPHANUMERIC | SPECIALCHARACTERS | LPAREN expr RPAREN -> expr )
            int alt16=6;
            switch ( input.LA(1) ) {
            case ALPHANUMERIC:
                {
                int LA16_1 = input.LA(2);

                if ( (LA16_1==LPAREN) ) {
                    alt16=1;
                }
                else if ( (LA16_1==EOF||LA16_1==QUOTE||(LA16_1>=RPAREN && LA16_1<=COMMA)||(LA16_1>=PLUS && LA16_1<=OR)) ) {
                    alt16=4;
                }
                else {
                    NoViableAltException nvae =
                        new NoViableAltException("", 16, 1, input);

                    throw nvae;
                }
                }
                break;
            case DOLLAR:
                {
                alt16=2;
                }
                break;
            case STRING:
                {
                alt16=3;
                }
                break;
            case SPECIALCHARACTERS:
                {
                alt16=5;
                }
                break;
            case LPAREN:
                {
                alt16=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 16, 0, input);

                throw nvae;
            }

            switch (alt16) {
                case 1 :
                    // ValParser.g:107:2: function
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_function_in_atom430);
                    function41=function();

                    state._fsp--;

                    adaptor.addChild(root_0, function41.getTree());

                    }
                    break;
                case 2 :
                    // ValParser.g:109:2: variableReference
                    {
                    root_0 = (Object)adaptor.nil();

                    pushFollow(FOLLOW_variableReference_in_atom436);
                    variableReference42=variableReference();

                    state._fsp--;

                    adaptor.addChild(root_0, variableReference42.getTree());

                    }
                    break;
                case 3 :
                    // ValParser.g:111:2: STRING
                    {
                    root_0 = (Object)adaptor.nil();

                    STRING43=(Token)match(input,STRING,FOLLOW_STRING_in_atom442); 
                    STRING43_tree = (Object)adaptor.create(STRING43);
                    adaptor.addChild(root_0, STRING43_tree);


                    }
                    break;
                case 4 :
                    // ValParser.g:113:2: ALPHANUMERIC
                    {
                    root_0 = (Object)adaptor.nil();

                    ALPHANUMERIC44=(Token)match(input,ALPHANUMERIC,FOLLOW_ALPHANUMERIC_in_atom450); 
                    ALPHANUMERIC44_tree = (Object)adaptor.create(ALPHANUMERIC44);
                    adaptor.addChild(root_0, ALPHANUMERIC44_tree);


                    }
                    break;
                case 5 :
                    // ValParser.g:115:2: SPECIALCHARACTERS
                    {
                    root_0 = (Object)adaptor.nil();

                    SPECIALCHARACTERS45=(Token)match(input,SPECIALCHARACTERS,FOLLOW_SPECIALCHARACTERS_in_atom458); 
                    SPECIALCHARACTERS45_tree = (Object)adaptor.create(SPECIALCHARACTERS45);
                    adaptor.addChild(root_0, SPECIALCHARACTERS45_tree);


                    }
                    break;
                case 6 :
                    // ValParser.g:117:2: LPAREN expr RPAREN
                    {
                    LPAREN46=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_atom469);  
                    stream_LPAREN.add(LPAREN46);

                    pushFollow(FOLLOW_expr_in_atom471);
                    expr47=expr();

                    state._fsp--;

                    stream_expr.add(expr47.getTree());
                    RPAREN48=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_atom473);  
                    stream_RPAREN.add(RPAREN48);



                    // AST REWRITE
                    // elements: expr
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (Object)adaptor.nil();
                    // 117:21: -> expr
                    {
                        adaptor.addChild(root_0, stream_expr.nextTree());

                    }

                    retval.tree = root_0;
                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "atom"

    // Delegated rules


 

    public static final BitSet FOLLOW_variableDeclaration_in_validator85 = new BitSet(new long[]{0x0000000000001332L});
    public static final BitSet FOLLOW_expr_in_validator88 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ALPHANUMERIC_in_variableName118 = new BitSet(new long[]{0x0000000000000032L});
    public static final BitSet FOLLOW_set_in_variableName120 = new BitSet(new long[]{0x0000000000000032L});
    public static final BitSet FOLLOW_variableName_in_variableDeclaration139 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_EQUAL_in_variableDeclaration142 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_expr_in_variableDeclaration145 = new BitSet(new long[]{0x0000000000000080L});
    public static final BitSet FOLLOW_QUOTE_in_variableDeclaration148 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_DOLLAR_in_variableReference186 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_variableName_in_variableReference188 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ALPHANUMERIC_in_function214 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_LPAREN_in_function216 = new BitSet(new long[]{0x0000000000001F30L});
    public static final BitSet FOLLOW_expr_in_function218 = new BitSet(new long[]{0x0000000000000C00L});
    public static final BitSet FOLLOW_COMMA_in_function222 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_expr_in_function224 = new BitSet(new long[]{0x0000000000000C00L});
    public static final BitSet FOLLOW_RPAREN_in_function228 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_andexpr_in_expr275 = new BitSet(new long[]{0x0000000001000002L});
    public static final BitSet FOLLOW_OR_in_expr279 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_andexpr_in_expr282 = new BitSet(new long[]{0x0000000001000002L});
    public static final BitSet FOLLOW_equalityexpr_in_andexpr299 = new BitSet(new long[]{0x0000000000800002L});
    public static final BitSet FOLLOW_AND_in_andexpr302 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_equalityexpr_in_andexpr305 = new BitSet(new long[]{0x0000000000800002L});
    public static final BitSet FOLLOW_relationalexpr_in_equalityexpr316 = new BitSet(new long[]{0x0000000000600002L});
    public static final BitSet FOLLOW_EQ_in_equalityexpr321 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_NEQ_in_equalityexpr326 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_relationalexpr_in_equalityexpr330 = new BitSet(new long[]{0x0000000000600002L});
    public static final BitSet FOLLOW_plusminusexpr_in_relationalexpr339 = new BitSet(new long[]{0x00000000001E0002L});
    public static final BitSet FOLLOW_GT_in_relationalexpr345 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_LT_in_relationalexpr350 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_GTE_in_relationalexpr355 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_LTE_in_relationalexpr360 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_plusminusexpr_in_relationalexpr365 = new BitSet(new long[]{0x00000000001E0002L});
    public static final BitSet FOLLOW_multdivideexpr_in_plusminusexpr379 = new BitSet(new long[]{0x0000000000006002L});
    public static final BitSet FOLLOW_PLUS_in_plusminusexpr384 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_MINUS_in_plusminusexpr389 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_multdivideexpr_in_plusminusexpr393 = new BitSet(new long[]{0x0000000000006002L});
    public static final BitSet FOLLOW_atom_in_multdivideexpr402 = new BitSet(new long[]{0x0000000000018002L});
    public static final BitSet FOLLOW_MULTIPLY_in_multdivideexpr407 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_DIVIDE_in_multdivideexpr412 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_atom_in_multdivideexpr416 = new BitSet(new long[]{0x0000000000018002L});
    public static final BitSet FOLLOW_function_in_atom430 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_variableReference_in_atom436 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_in_atom442 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ALPHANUMERIC_in_atom450 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_SPECIALCHARACTERS_in_atom458 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LPAREN_in_atom469 = new BitSet(new long[]{0x0000000000001330L});
    public static final BitSet FOLLOW_expr_in_atom471 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_RPAREN_in_atom473 = new BitSet(new long[]{0x0000000000000002L});

}